From: Matthias Clasen Date: Thu, 30 Aug 2018 17:12:18 +0000 (-0400) Subject: print portal: use request path utilities X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~32^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=c3077467d0b370d445ec404e4a0e042d1c879b89;p=gtk%2B3.0.git print portal: use request path utilities Less code duplication, more cookies! --- diff --git a/gtk/gtkprintoperation-portal.c b/gtk/gtkprintoperation-portal.c index 484302fa12..fb3dad0f04 100644 --- a/gtk/gtkprintoperation-portal.c +++ b/gtk/gtkprintoperation-portal.c @@ -556,17 +556,9 @@ call_prepare_print (GtkPrintOperation *op, GtkPrintOperationPrivate *priv = op->priv; GVariantBuilder opt_builder; char *token; - char *sender; - int i; - token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT)); - sender = g_strdup (g_dbus_connection_get_unique_name (g_dbus_proxy_get_connection (portal->proxy)) + 1); - for (i = 0; sender[i]; i++) - if (sender[i] == '.') - sender[i] = '_'; - - portal->prepare_print_handle = g_strdup_printf ("/org/fredesktop/portal/desktop/request/%s/%s", sender, token); - g_free (sender); + portal->prepare_print_handle = + gtk_get_portal_request_path (g_dbus_proxy_get_connection (portal->proxy), &token); portal->response_signal_id = g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (G_DBUS_PROXY (portal->proxy)),